import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Form Demo"),
      ),
      body: InputStyleWidget(),
    ),
  ));
}

class InputStyleWidget extends StatefulWidget {
  @override
  _InputStyleWidgetState createState() => _InputStyleWidgetState();
}

class _InputStyleWidgetState extends State<InputStyleWidget> {
  @override
  Widget build(BuildContext context) {
    return Theme(
        data: Theme.of(context).copyWith(
          hintColor: Colors.grey[200],
          inputDecorationTheme: const InputDecorationTheme(
            labelStyle: TextStyle(color: Colors.grey),
            hintStyle: TextStyle(color: Colors.grey, fontSize: 14.0),
          ),
        ),
        child: Column(
          children: <Widget>[
            Container(
              decoration: const BoxDecoration(
                // 下滑线浅灰色，宽度1像素
                  border: Border(
                      bottom: BorderSide(color: Colors.grey, width: 1.0))),
              child: const TextField(
                decoration: InputDecoration(
                    labelText: "用户名",
                    hintText: "用户名或邮箱",
                    prefixIcon: Icon(Icons.person),
                    border: InputBorder.none //隐藏下划线

                ),

              ),
            ),
            Container(
              decoration: const BoxDecoration(
                // 下滑线浅灰色，宽度1像素
                  border: Border(
                      bottom: BorderSide(color: Colors.grey, width: 1.0))),
              child: const TextField(
                decoration: InputDecoration(
                    prefixIcon: Icon(Icons.lock),
                    labelText: "密码",
                    hintText: "您的登录密码",
                    border: InputBorder.none //隐藏下划线
                ),
              ),
            )
          ],
        ));
  }
}
